/* 员工管理相关的接口 */

import request from '@/utils/request'

/* 获取员工列表接口 */
export const getEmployeeListAPI = (params) => {
  return request({
    url: '/sys/user',
    method: 'GET',
    params
  })
}

/* 删除员工的接口 */
export const deleteEmployeeAPI = (id) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'DELETE'
  })
}

/* 新增员工的接口 */
export const addEmployeeAPI = (data) => {
  return request({
    url: '/sys/user',
    method: 'POST',
    data
  })
}

/* 获取员工详情的接口 */
export const findEmployeeAPI = (id) => {
  return request({
    url: `/sys/user/${id}`,
    method: 'GET'
  })
}
/* 修改员工的接口 */
export const updateEmployeeAPI = (data) => {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'PUT',
    data
  })
}

/* 获取excel模板的接口 */
export const getExportTemplate = () => {
  return request({
    url: '/sys/user/import/template',
    responseType: 'blob'
  })
}

/* 批量导入员工(上传excel)的接口 */
export const uploadExcelAPI = (file) => {
  return request({
    url: '/sys/user/import',
    method: 'POST',
    data: file
  })
}

/* 群发通知的接口 */
export const sendMessageAPI = (data) => {
  return request({
    url: '/sys/messageMuch',
    method: 'POST',
    data
  })
}
/* 获取已启用的角色列表接口 */
export const getEnabledRoleListAPI = () => {
  return request({
    url: '/sys/role/list/enabled',
    method: 'GET'
  })
}

/* 给员工分配角色的接口 */
export const assignRolesAPI = (data) => {
  return request({
    url: '/sys/user/assignRoles',
    method: 'PUT',
    data
  })
}
